<?php
// Check whether the development is on
if(DEVELOPMENT)
{
	// Display all errors
	error_reporting(E_ALL);

	function p($vardump = null, $die = 1)
	{
		// Get the backtrace array
		$stacktrace = debug_backtrace();

		// Get the last entry
		$stackEntry = $stacktrace[0];

		// Display the dump
		echo '<pre>';
		echo 'p() used in '.removePathBaseFromPath($stackEntry['file']).'('.$stackEntry['line'].')'."\n\n";
		echo '<div style="background:URL(./design/skin/default/development_pre.png) repeat;">';
		var_dump($vardump);
		echo '</div>';

		// Check whether we want to stop the script
		if($die)
		{
			echo "\n".'p() exited the script.';
			exit(0);
		}

		// Display the end pre tag whenever the script is not aborted
		echo '</pre>';
	}

	// Set the iDebug counter
	$iDebug = 0;

	function i($vardump = null, $k = 0, $die = 1)
	{
		// Get the iDebug counter
		global $iDebug;

		// Check whether the iDebug counter is the same as the k-param
		if($k == $iDebug)
		{
			// P the shit
			p($vardump, $die);
		}

		// Increase the iDebug counter
		$iDebug++;
	}
}
// The development mode is off
else
{
	// Display no errors
	error_reporting(0);
}